home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Commun⁄Network / NetNews Sample Code ƒ / News src / CNewsApp.c < prev    next >
Text File  |  1990-10-16  |  2KB  |  110 lines

  1. /*
  2.  * CNewsApp.c
  3.  *
  4.  *    Application methods for a simple netnews reader
  5.  */
  6.  
  7. #include <Commands.h>
  8. #include "CNewsApp.h"
  9.  
  10. #define    ALERTabout    120
  11.  
  12. extern    OSType    gSignature;
  13.  
  14. /***
  15.  * IStarterApp
  16.  ***/
  17.  
  18. void CNewsApp::IStarterApp(void)
  19.  
  20. {
  21.     CApplication::IApplication(4, 20480L, 2048L);
  22. }
  23.  
  24.  
  25. /***
  26.  * SetUpFileParameters
  27.  ***/
  28.  
  29. void CNewsApp::SetUpFileParameters(void)
  30.  
  31. {
  32.     inherited::SetUpFileParameters();    /* call the default method */
  33.  
  34.     sfNumTypes = 1;
  35.     sfFileTypes[0] = 'TEXT';
  36.  
  37.     gSignature = '????';
  38. }
  39.  
  40.  
  41. /***
  42.  * SetUpMenus 
  43.  *
  44.  * Set up menus which must be created at run time, such as a
  45.  * Font menu. You can eliminate this method if your application
  46.  * does not have any such menus.
  47.  *
  48. ***/
  49.  
  50.  void CNewsApp::SetUpMenus()
  51.  {
  52.  
  53.   inherited::SetUpMenus();  /*  Superclass takes care of adding     
  54.                                 menus specified in a MBAR id = 1    
  55.                                 resource    
  56.                             */                          
  57.  }
  58.  
  59.  
  60.  
  61. /***
  62.  * DoCommand
  63.  *
  64.  ***/
  65. void CNewsApp::DoCommand(long theCommand)
  66.  
  67. {
  68.     switch (theCommand) {
  69.     
  70.         case cmdAbout:
  71.             Alert(ALERTabout, 0);
  72.             break;
  73.     
  74.         default:    inherited::DoCommand(theCommand);
  75.                     break;
  76.     }
  77. }
  78.  
  79.  
  80. /***
  81.  *
  82.  * UpdateMenus 
  83.  *
  84.  *   Perform menu management tasks
  85.  *
  86. ***/
  87.  
  88.  void CNewsApp::UpdateMenus()
  89.  {
  90.   inherited::UpdateMenus();     /* Enable standard commands */      
  91.  }
  92.  
  93.  
  94. /*
  95.  * Exit
  96.  *
  97.  */
  98.  
  99. void CNewsApp::Exit()
  100.  
  101. {
  102.     close_server();
  103.     save_newsrc();
  104. }
  105.  
  106.  
  107. void CNewsApp::StartUpAction(short numPreloads)
  108. {
  109.     init_news();
  110. }